package sprites;

import java.awt.image.BufferedImage;

import com.golden.gamedev.object.Timer;

import engine.TowerDefense;

/**
 * Abstract class representing an enemy.
 * 
 * @author Alex Lee (hl69)
 */
public abstract class Enemy extends TDEntity
{

	public static final int STOPPED = 0, MOVING = 1;

	double myVelocity;

	/*
	 * Enemies can attack.
	 */
	int damage;
	Timer firingRate;

	/*
	 * Enemies have value, which is the amount of money the players gets when
	 * the enemy dies.
	 */
	int value;

	public Enemy(TowerDefense owner, BufferedImage[] image, double x, double y)
	{
		super(owner, image, x, y);
	}

	public void kill()
	{
		super.kill();

		myOwner.addMoney(value);
	}

	public int getDamage()
	{
		return damage;
	}

	protected void animationChanged(int oldStat, int oldDir, int status, int direction)
	{
		if(status == STOPPED) setHorizontalSpeed(0);
		if(status == MOVING) setHorizontalSpeed(myVelocity);
	}

}
